<template>
  <div class="search-filter-bar" :isShow="show" :class="{'fixed':fixed, 'hasFilter':hasFilter}">
    <input type="text" placeholder="搜索" class="search-input" v-model="searchVal" />
    <!-- <span class="cancel-btn">取消</span> -->
  </div>
</template>
<script>
  export default {
    props: {
      hasFilter: {
        default: true
      },
      fixed: {
        default: true
      }
    },
    data () {
      return {
        show: false,
        searchVal:''
      }
    },
    watch: {
      searchVal(value) {
        this.$emit('search-change', value)
      }
    }

  }
</script>
<style lang="less">
  @import '../less/index.less';

  .search-filter-bar {
    top:0;

    &:not(.fixed) {
      position: absolute;
    }

    &.fixed {
      position: fixed;
    }

    &.hasFilter {
      top: @top-filter-size
    }

    left:0;
    z-index: 102;
    width: 100%;
    padding: 4px 0;
    background-color: white;
    border: 1px solid #EDEDED;
    white-space: nowrap;
    overflow: hidden;
    -webkit-user-select:none;
    -moz-user-select:none;
    -ms-user-select:none;
    user-select:none;
  }

  .search-input {
    width: 96%;
    height: @search-input-size;
    line-height: @search-input-size;
    margin: 0 auto;
    // margin-left: 10px;
    text-indent: 1em;
    font-size: 14px;
    -webkit-appearance:none;
    border-radius: 0;
    border: 1px solid #EDEDED;
    display: block;
    // float: left;
  }

  .cancel-btn {
    padding: 0 6px;
    margin: 0;
    border: 1px solid #EDEDED;
    height: @search-input-size;
    line-height: @search-input-size;
    width: 10%;
    border-radius: 2px;
    float: right;
    margin-right:6px;
    color: #35ADFF;
    text-align: center;
  }
</style>
